#include "tmiconfactory.h"

#include <QPainter>
#include <QtDebug>

//
CTMIconFactory::CTMIconFactory(  ) 
{
	// TODO
}
//

QIcon CTMIconFactory::getAppIcon(const QSize &size)
{
	// todo - we need some sort of data path, so we know where to get these files from.
	// for now, just hard code the paths.
	if (m_svgRenderer.load(QString("../common/images/icons/teacup.svg")))
	{
		// render to the pixmap:
		QPixmap pix(size);
		pix.fill(QColor(0,0,0,0));
		
		// this scope manages starting and stopping the painter.
		{
			QPainter painter(&pix);
			m_svgRenderer.render(&painter);	
			
			qWarning() << "Rendering teacup icon from SVG";
		}
		
		return QIcon(pix);
	}
	else
	{
		qWarning() << "Could not load teacup SVG file.";
	}
	return QIcon();
}
